﻿using Microsoft.Phone.Shell;
using System;
using System.ComponentModel;
using System.Windows.Media;

namespace SMARTMobile.WinPhone
{
    public class PhoneApplicationBar : INotifyPropertyChanged
    {
        private bool _isVisible;
        private double _opacity;
        private bool _isEnabled;
        private Color _backgroundColor;
        private Color _foregroundColor;

        public PhoneApplicationBar()
        {
            IsVisible = true;
            Buttons = new ObviousCollection<IApplicationBarIconButton>();
            MenuItems = new ObviousCollection<IApplicationBarMenuItem>();
        }

        public bool IsVisible
        {
            get { return _isVisible; }
            set { _isVisible = value; NotifyPropertyChanged("IsVisible"); }
        }

        public double Opacity
        {
            get { return _opacity; }
            set { _opacity = value; NotifyPropertyChanged("Opacity"); }
        }

        public bool IsMenuEnabled
        {
            get { return _isEnabled; }
            set { _isEnabled = value; NotifyPropertyChanged("IsMenuEnabled"); }
        }

        public Color BackgroundColor
        {
            get { return _backgroundColor; }
            set { _backgroundColor = value; NotifyPropertyChanged("BackgroundColor"); }
        }

        public Color ForegroundColor
        {
            get { return _foregroundColor; }
            set { _foregroundColor = value; NotifyPropertyChanged("ForegroundColor"); }
        }

        public ApplicationBarMode Mode
        {
            get;
            set;
        }

        public double DefaultSize
        {
            get;
            set;
        }

        public double MiniSize
        {
            get;
            set;
        }

        public ObviousCollection<IApplicationBarIconButton> Buttons
        {
            get;
            private set;
        }

        public ObviousCollection<IApplicationBarMenuItem> MenuItems
        {
            get;
            private set;
        }

        public event EventHandler<ApplicationBarStateChangedEventArgs> StateChanged;
        public event PropertyChangedEventHandler PropertyChanged;

        private void NotifyPropertyChanged(string propertyname)
        {
            if (null != PropertyChanged) PropertyChanged(this, new PropertyChangedEventArgs(propertyname));
        }
    }
}
